package com.boot.security.server.dao.record;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.record.TswUserSearchHistory;

@Mapper
public interface TswUserSearchHistoryDao {

    @Select("select * from tsw_user_search_history t where t.id = #{id}")
    TswUserSearchHistory getById(Long id);

    @Delete("delete from tsw_user_search_history where id = #{id}")
    int delete(Long id);

    int update(TswUserSearchHistory tswUserSearchHistory);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into tsw_user_search_history(user_id, search_keyword, search_time, search_note, search_remark) values(#{userId}, #{searchKeyword}, #{searchTime}, #{searchNote}, #{searchRemark})")
    int save(TswUserSearchHistory tswUserSearchHistory);
    
    int count(@Param("params") Map<String, Object> params);

    List<TswUserSearchHistory> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
